import java.util.ArrayList;
import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * user:likai
 * Date:2022-10-12
 * Time:17:17
 */
public class PokerTest {
    public static void swap(ArrayList<Poker> pokerArrayList,int ret,int i){
        Poker poker=pokerArrayList.get(ret);
        pokerArrayList.set(ret,pokerArrayList.get(i));
        pokerArrayList.set(i,poker);
    }
    public static void main(String[] args) {
        //初始化扑克
        Pokers pokers=new Pokers();
        //ArrayList<Pokers> arrayList=new ArrayList<>();
        ArrayList<Poker> pokerArrayList=pokers.initialize();
        //System.out.println(pokerArrayList);
        //洗牌
        Random random=new Random();
        for (int i = pokerArrayList.size()-1; i >0 ; i--) {
            int ret=random.nextInt(i);
            swap(pokerArrayList,ret,i);
        }
        //System.out.println(pokerArrayList);
        //发牌
        ArrayList<Poker> hand1=new ArrayList<>();
        ArrayList<Poker> hand2=new ArrayList<>();
        ArrayList<Poker> hand3=new ArrayList<>();
        ArrayList<ArrayList<Poker>> hand=new ArrayList<>();
        hand.add(hand1);
        hand.add(hand2);
        hand.add(hand3);
        //输出每个人手上的牌
        for (int i = 0; i < 15; i++) {
            hand.get(i%3).add(pokerArrayList.remove(i));
        }
        System.out.println(hand1);
        System.out.println(hand2);
        System.out.println(hand3);
        //剩余的牌
        //System.out.println(pokerArrayList);
    }
}
